#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int i = 0;
	for (i = 2; i <=1000; i++)
	{
		int n = 2;
		int sum = 1;
		for (n = 2; n <=i-1; n++)
		{
			if (i % n == 0)
				sum += n;
		}
		if (sum == i)
			printf("%d\n", i);
	}
	return 0;
}